<template>
  <div>
    <el-dialog
      title="有蚁列表→处理日志"
      :visible.sync="show"
      :before-close="cancel"
      width="50%"
    >
      <div class="formBox">
        <!-- <div class="formHead">处理日志</div> -->
        <el-table
          v-loading="loading"
          :data="messageList"
          border
          stripe
          :key="2"
        >
          <!-- <el-table-column label="ID" align="center" prop="logId"/> -->
          <!-- <el-table-column label="点位号" align="center" prop="pointNumber"/> -->
          <el-table-column label="处理人" align="center" prop="handleName" />
          <el-table-column label="处理日期" align="center" prop="handleTime" />
          <el-table-column
            label="处理结果"
            align="center"
            prop="handleResult"
          />

          <el-table-column
            label="照片"
            align="center"
            class-name="small-padding fixed-width"
            fixed="right"
          >
            <template slot-scope="scope">
              <el-button size="mini" type="text" @click="messageEdit(scope.row)"
                >查看照片</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" plain @click="cancel" size="small"
          >返回</el-button
        >
      </span>
    </el-dialog>
    <el-dialog title="查看凭证" :visible.sync="voucherVisible" width="30%">
      <div v-loading="!imgUrl" style="min-height: 200px">
        <el-image
          v-if="imgUrl"
          style="width: 100%; height: 100%"
          :src="imgUrl"
          fit="fill"
        ></el-image>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  // getToken
  queryHandleLog, // 查询处理日志
} from "@/api/manage/asset";

export default {
  props: ["detailDis", "id", "detailRow", "show"],
  data() {
    return {
      voucherVisible: false,
      imgUrl: "",
      loading: false,
      messageList: [],
      messageTotal: 0,
    };
  },
  created() {
    // getToken()
    queryHandleLog({ id: this.id }).then((res) => {
      if (res.errorCode == "000000") {
        this.messageList = res.data.list;
        this.messageTotal = this.messageList.length;
      }
    });
  },
  methods: {
    cancel() {
      this.$emit("closeMsg");
    },
    messageEdit(row) {
      if (!row.voucher) {
        this.$modal.msgWarning("该记录没有照片");
        return;
      }

      // 直接使用完整的 URL
      this.voucherVisible = true;
      this.imgUrl = row.voucher;
    },
  },
};
</script>

<style lang="scss" scoped>
// .app-main {
.formBox {
  .left {
    display: inline-block;
    height: 44px;
    line-height: 44px;
    width: 120px;
    padding-right: 15px;
    border-left: 1px solid #e4e4dc;
    border-right: 1px solid #e4e4dc;
    font-family: MicrosoftYaHei;
    font-size: 12px;
    color: #303133;
    text-align: right;
    vertical-align: top;
  }
  .right {
    display: inline-block;
    width: calc(100% - 120px);
    height: 44px;
    border-right: 1px solid #e4e4dc;
    padding: 6px 15px;
    .el-select {
      width: 100% !important;
    }
    .el-input {
      width: 100% !important;
    }
  }
  .formHead {
    width: 100%;
    height: 44px;
    background-color: #5d6d7f;
    height: 44px;
    line-height: 44px;
    text-align: center;
    font-family: MicrosoftYaHei, MicrosoftYaHei;
    font-weight: bold;
    font-size: 12px;
    color: #ffffff;
  }
  .formWhite {
    width: 100%;
    height: 44px;
    background-color: #fff;
    border-bottom: 1px solid #e4e4dc;
  }
  .formGray {
    width: 100%;
    height: 44px;
    background-color: #dbe2e6;
    border-bottom: 1px solid #e4e4dc;
  }
}
.mainName {
  font-family:
    PingFangSC,
    PingFang SC;
  font-weight: 500;
  font-size: 16px;
  height: 30px;
  line-height: 30px;
  color: #000000;
  border-bottom: 1px solid #dcdfe6;
  margin-bottom: 10px;
}
::v-deep .el-dialog__header {
  border-bottom: 1px solid #e9e9ec;
}
::v-deep .el-dialog__footer {
  border-top: 1px solid #e9e9ec;
}
// }
.el-collapse .el-collapse-item__header {
  font-size: 16px;
  font-weight: bold;
}

.pagination-container {
  margin-top: 20px;
  width: 100%;
}

.pagination-container .el-pagination {
  display: flex;
  justify-content: center;
  width: 100%;
}
</style>
